import Vue from "vue";
import VueRouter from "vue-router";
// import HomeView from "../views/Home.vue";



Vue.use(VueRouter);

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
 return originalPush.call(this, location).catch(err => err)
}
const routes = [
  {
    path:'/',
    component: ()=> import('../views/login'),
  },
  {
    path: "/main",
    name: "Main",
    component: ()=> import('../views/Main'),
    children:[
      
      {
        path:'/login',
        name:'login',
        component: () => import('../views/login')
      },
      {
        path:'/home',
        name:'home',
        component: () => import('../views/home')
      },
     
      {
        path:'/clothes',
        name:'Clothes',
        component: () => import('../views/clothes')
      },
      {
        path:'/inventory',
        name:'inventory',
        component: () => import('../views/inventory')
      },
      {
        path:'/report',
        name:'report',
        component: () => import('../views/report')
      },
      {
        path:'/order',
        name:'order',
        component: () => import('../views/order')
      },
      {
        path:'/discount',
        name:'discount',
        component: () => import('../views/other/discount.vue')
      },
      {
        path:'/users',
        name:'users',
        component: () => import('../views/users/users.vue')
      }
    ]
  },
  
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
